package ThreadPool2;

import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class mulitreadGUI {
    private JPanel panel1;
    private JTextField txtHostName;
    private JTextField txtHostPort;

    public mulitreadGUI() {
        btnStart.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                NetPrintStream printStream=new NetPrintStream(System.out,txtResult);
                System.setErr(printStream);
                System.setOut(printStream);
                TCPServer_Thread tcpServer_thread = new TCPServer_Thread();
                tcpServer_thread.start();
            }
        });
        退出Button.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                System.exit(0);
            }
        });
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame("mulitreadGUI");
        frame.setContentPane(new mulitreadGUI().panel1);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }

    private JTextArea txtResult;
    private JButton btnStart;
    private JButton 退出Button;


}
